<?php
/**
 * Created by PhpStorm.
 * User: 10037
 * Date: 2022/5/28
 * Time: 16:13
 */

namespace app\admin\controller;


use think\facade\Filesystem;
use think\facade\Request;

class Upload
{
    public function addFile(){
        $file=Request::file('file');

        $savename=Filesystem::disk('public')->putFile('image',$file);

        return 'storage/'.$savename;
    }

    public function deleteFile(){
        $filePath=Request::post('filePath');
        if(file_exists($filePath)){
            if(unlink($filePath)){
                return true;
            }else{
                return false;
            }
        }else{
            return false;
        }
    }
}